package com.zrl.ggkt.activity.api;

import com.zrl.ggkt.activity.service.CouponInfoService;
import com.zrl.ggkt.model.activity.CouponInfo;
import com.zrl.ggkt.result.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zrl
 * @date: 2022/8/20 17:47
 * @description:
 */
@Api(tags = "优惠券接口")
@RestController
@RequestMapping("/api/activity/couponInfo")
public class CouponInfoApiController {

    @Autowired
    private CouponInfoService couponInfoService;

    //获取优惠券
    @GetMapping(value = "inner/getById/{couponId}")
    public CouponInfo getById(@PathVariable Long couponId){
        CouponInfo couponInfo = couponInfoService.getById(couponId);
        return couponInfo;
    }

    //更新优惠券使用状态
    @GetMapping(value = "inner/updateCouponInfoUseStatus/{couponUseId}/{orderId}")
    public Boolean updateCouponInfoUseStatus(@PathVariable Long couponUseId,
                                             @PathVariable Long orderId){
        couponInfoService.updateCouponInfoUseStatus(couponUseId,orderId);
        return true;
    }
}
